#pragma once

#ifndef _USER_SYS_BCGCPRO_INCLUDE_
#include <BCGCBPro/bcgpreportctrl.h>			// BCGPro Control Bar
#else    
#include <bcgpreportctrl.h>
#endif


class bcg_ico_item : public CBCGPGridItem
{
	virtual void OnDrawIcon (CDC* pDC, CRect& rect)
	{
		if (m_iImage < 0)
		{
			return;
		}

		ASSERT_VALID (m_pGridRow);

		CBCGPGridCtrl* pWndList = GetParentRow()->GetOwnerList();
		ASSERT_VALID (pWndList);

		if (pWndList->GetImageList () == NULL)
		{
			return;
		}

		int cx = 0;
		int cy = 0;

		VERIFY (::ImageList_GetIconSize (*pWndList->GetImageList(), &cx, &cy));
		rect.left = rect.left + (rect.Width() -cx)/2;

		if (rect.left + cx > rect.right)
		{
			return;
		}

		CPoint pt = rect.TopLeft ();

		pt.x++;
		pt.y = (rect.top + 1 + rect.bottom - cy) / 2;

		VERIFY (pWndList->GetImageList()->Draw (pDC, m_iImage, pt, ILD_NORMAL));

		rect.left += cx;
	}
};


class bcg_report_ctrl_ex :
	public CBCGPReportCtrl
{
public:
	bcg_report_ctrl_ex(void);
public:
	~bcg_report_ctrl_ex(void);
public:
	virtual BOOL OnHideInsertedGroupColumn (int /*nColumn*/) const
	{
		return TRUE;
	}
public:
	DECLARE_MESSAGE_MAP()

public:
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	virtual void OnDrawGroupByBox (CDC* pDC, CRect rect);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnSize(UINT nType, int cx, int cy);

	void on_grid_header_menu_notify(UINT msg_id);
	void set_parent_wnd(HWND hwnd){ this->parent_wnd_ = hwnd;}
	void get_select_rows(CArray<int>& row_id_list);

	HWND parent_wnd_;
	int sel_column_;
	CFont my_font_;
};
